//
//  LBBaseViewController.m
//  app
//
//  Created by LINAICAI on 16/4/29.
//  Copyright © 2016年 广东联结电子商务有限公司. All rights reserved.
//

#import "LBBaseViewController.h"
@interface LBBaseViewController ()
@property(nonatomic , strong)UIBarButtonItem *shareBarButtonItem;
@end

@implementation LBBaseViewController
-(UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}
- (BOOL)prefersStatusBarHidden{
    return NO;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

{
    
    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
    
}

- (BOOL)shouldAutorotate

{
    
    return YES;
    
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations

{
    return UIInterfaceOrientationMaskPortrait;//只支持这一个方向(正常的方向)
}
- (UIBarButtonItem *)shareBarButtonItem{
    if (!_shareBarButtonItem) {
        _shareBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"LBBaseController.bundle/lb_share_icon.png"] style:UIBarButtonItemStylePlain target:self action:@selector(shareClick:)];
    }
    return _shareBarButtonItem;
}
- (void)loadView {
    [super loadView];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    //处理偏移问题
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self setEdgesForExtendedLayout:UIRectEdgeNone];

    self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:self.navigationItem.backBarButtonItem.style target:nil action:nil];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    self.safeAnimation = NO;
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
    self.safeAnimation = NO;
}
- (void)shareClick:(id)sender{
    ///请重写分享按钮事件
}

- (void)navigationBack:(id)sender{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)dealloc{
    NSLog(@"%@已释放",NSStringFromClass([self class]));
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
